package com.lovo.work.frame;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

import com.lovo.netCRM.component.LovoButton;
import com.lovo.netCRM.component.LovoCheckBox;
import com.lovo.netCRM.component.LovoComboBox;
import com.lovo.netCRM.component.LovoDate;
import com.lovo.netCRM.component.LovoFileChooser;
import com.lovo.netCRM.component.LovoLabel;
import com.lovo.netCRM.component.LovoRadioButton;
import com.lovo.netCRM.component.LovoTitleLabel;
import com.lovo.netCRM.component.LovoTxt;
import com.lovo.netCRM.component.LovoTxtArea;


/**
 * 职位增加对话框
 * @author 白德柯
 *
 */
public class WorkAddDialog extends JDialog{
	/**职位主面板*/
	private WorkPanel workPanel;

	/**职位名称文本框*/
	private LovoTxt nameTxt = new LovoTxt("职位名称",40,90,this);
	/**职位描述文本框*/
	private LovoTxtArea infoTxt = new LovoTxtArea("职位描述",40,130,130,100,this);
	/**权限管理复选框*/
	private LovoCheckBox dataManage = new LovoCheckBox("权限", new String[]{"资料管理","学校管理","用户管理","统计信息"}, 40, 240, this);
	

	
	public WorkAddDialog(JFrame jf,WorkPanel workPanel){
		super(jf,true);
		this.workPanel = workPanel;
		this.setLayout(null);
		this.setTitle("职位增加");
		this.init();
		
		Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
		int x = (int) screensize.getWidth() / 2 - 270;
		int y = (int) screensize.getHeight() / 2 - 240;
		this.setBounds(x, y, 540, 480);
		this.setVisible(true);
	}
	/**
	 * 初始化
	 *
	 */
	private void init(){
		LovoTitleLabel titleLabel = new LovoTitleLabel("职位增加",this);
		titleLabel.setLocation(200, titleLabel.getY());
		
		
		LovoButton addButton = new LovoButton(150,330,"添加","image/add.png",this);
		addButton.addActionListener(new ActionListener(){

			public void actionPerformed(ActionEvent e) {
				boolean isOk = add();
				if(isOk){
					WorkAddDialog.this.dispose();
				}
			}});
		
	}

	/**
	 * 添加操作
	 *
	 */
	private boolean add(){
		System.out.println(Arrays.toString(dataManage.getIntItem()));
		return true;
	}

}
